<?php

/**
 * 自动生成接口状态码Markdown文件
 */

use SinoPHP\BbdBoss\Defines\ApiCode;

require_once __DIR__ . '/../UpforPHP/bootstrap.php';
require_once __DIR__ . '/../vendor/autoload.php';

$apiCodeList = ApiCode::$statusCode;
$mdDoc[] = '| 状态码 | 含义 |';
$mdDoc[] = '| :-: | - |';
foreach ($apiCodeList as $code => $msg) {
    $mdDoc[] = '| ' . (string) $code . ' | ' . $msg . ' |';
}

file_put_contents(DATA_DIR . '/api_code.md', implode("\n", $mdDoc));
